<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE>
<html>

<head lang="en">
<meta charset="UTF-8">
<title>有间花店 | 后台管理</title>
<link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico">
<link href="css/bootstrap.min.css" rel="stylesheet">

<script src="js/html5shiv.js"></script>
<script src="js/respond.min.js"></script>
<!-- 引入css样式-->
<link rel="stylesheet" type="text/css" href="css/admin.css"
	media="screen">
<script src="js/jquery-1.11.3.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/admin.js"></script>

<style type="text/css">
a:focus, a:hover {
	text-decoration: none;
}

.panel-body {
	text-align: left;
}

#mytable th, #mytable td {
	text-align: center;
	vertical-align: middle;
	font-size: 14px;
}
</style>
</head>

<body>

	<div class="wrap">
		<!-- 左边内容 -->
		<jsp:include page="/admin_menu.jsp"></jsp:include>

		<!-- 右边内容 -->
		<div id="right" class="tab-content right">

			<!-- 出货单详情模块-->
			<div>
				<div id="sp_add">
					<div class="panel panel-info">
						<div class="panel-heading">位置：出货单详情</div>
					</div>

					<form id="sp_add_left" method="POST"
						style="width: 100%;">

						<div style="float: left;">
							<table>

								<tr>
									<td>订单号：</td>
									<td>收货人姓名：</td>
									<td>收货人地址：</td>
									<td>联系电话：</td>
									<td>下单时间：</td>
									<td>订单状态：</td>
									<td>单价：</td>
									<td>支付总额：</td>
									<td>商品名称：</td>
									<td>商品图片：</td>
									<td>购买数量：</td>
									<td>发货数量：</td>
								</tr>

								<c:forEach items="${data}" var="data">
								<tr>
									<td>${data.onum}</td>
								    <td>${data.receiver}</td>
									<td>${data.address}</td>
									<td>${data.tel}</td>
									<td><fmt:formatDate value="${data.time}" pattern="yyyy-MM-dd HH:mm" /></td>
									<td>${data.ostate==0 ? '未付款':data.ostate==1 ? '已付款待发货' :data.ostate==2 ? '已发货待收货':'已收货'}</td>
									<td>${data.shop_price}</td>
									<td>${data.shop_price * data.pay_count}</td>
									<td>${data.pname}</td>
									<td><img src="${data.pimage}"
									style="width: 100px; height: 100px;"></td>
									<td>${data.pay_count}</td>
									<td>${data.send_count}</td>

								</tr>


								</c:forEach>
								
								<tr>
									订单总价： ￥：${data.get(0).ototal}
									<c:if test="${data.get(0).ostate=='1'}">
										<button type="button"  id="fh" name="fh" onclick="editOrder('${data.get(0).onum}',${data.get(0).pid})" disabled
												class="btn btn btn-info" data-toggle="modal" data-target="#editOrder">发货</button>
									</c:if>
								</tr>

							</table>
						</div>


					</form>

					<div style="margin: 485px;">
						<a href="${pageContext.request.contextPath}/selectAllOrder.do"><button
								id="btn_submit" type="submit">返回</button></a>
					</div>
				</div>
			</div>
		</div>

</body>
<script>

	if (${data.get(0).ostate==1}) {

		$("button[name='fh']").removeAttr("disabled");
	}

	function editOrder(onum,pid){


		if(confirm("确实要发货吗？")){

		location.href="${pageContext.request.contextPath}/showEditOrder.do?onum="+onum+"&&pid="+pid;

		alert("发货成功");

			location.href="${pageContext.request.contextPath}/showOrderDetails.do?orderId="+${data.get(0).oid};

			$("button[name='fh']").attr("disabled","disabled")

		}
	}





</script>

</html>
